/**
 * 
 */
package com.freecycle.sg.http;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

/**
 * Base class to handle all HTTP requests. Responses will be return through the
 * call back objects
 * 
 * This class implements the singleton Java pattern that helps to maintain
 * users' session across application
 * 
 * @author Dang Chien
 */
public class HTTPManager {

	private static AsyncHttpClient httpClient = new AsyncHttpClient();

	public static AsyncHttpClient getHTTPClientInstance() {
		return httpClient;
	}

	public static void get(String url, RequestParams params,
			AsyncHttpResponseHandler responseHandler) {
		httpClient.get(url, params, responseHandler);
	}

	public static void post(String url, RequestParams params,
			AsyncHttpResponseHandler responseHandler) {
		httpClient.post(url, params, responseHandler);
	}

	public static void put(String url, RequestParams params,
			AsyncHttpResponseHandler responseHandler) {
		httpClient.put(url, params, responseHandler);
	}

}
